﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace SPWeiBo.Utilities
{
    internal static class SPWeiBoUtility
    {
        internal static SPUser GetFieldValueAsUser(this SPListItem item, String field)
        {
            var fieldValue = item[field] as String;
            var userId = Int32.Parse(fieldValue.Substring(0, fieldValue.IndexOf(";#")));
            var user = item.ParentList.ParentWeb.AllUsers.GetByID(userId);
            return user;
        }
    }
}
